using System;
using System.Configuration;

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Win;
using System.Threading;
using DevExpress.ExpressApp.Security;

namespace XCRM.Win {
	public class Program {
        private static void winApplication_CustomizeFormattingCulture(object sender, CustomizeFormattingCultureEventArgs e) {
            //e.FormattingCulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
            e.FormattingCulture = System.Globalization.CultureInfo.GetCultureInfo("zh-CN");
        }

		[STAThread]
		public static void Main(string[] arguments) {
			XCRMWinApplication winApplication = new XCRMWinApplication();
#if EasyTest
			try {
				DevExpress.ExpressApp.EasyTest.WinAdapter.RemotingRegistration.Register(4100);
			}
			catch(Exception) { }
#endif
            winApplication.CustomizeFormattingCulture += new EventHandler<CustomizeFormattingCultureEventArgs>(winApplication_CustomizeFormattingCulture);
            winApplication.ConnectionString = string.Format("XpoProvider=XmlDataSet; Data Source={0}xcrm.xml", AppDomain.CurrentDomain.SetupInformation.ApplicationBase);
            try {
                if(ConfigurationManager.ConnectionStrings["ConnectionString"] != null) {
                    winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                }
#if EasyTest
                winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
#endif
				winApplication.Setup();
				winApplication.Start();
			}
			catch(Exception e) {
				winApplication.HandleException(e);
			}
		}
	}

}
